home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / libcruft / balgen / balgen.f next >
Text File  |  1996-07-19  |  3KB  |  103 lines

  1.       subroutine balgen (n,ma,a,mb,b,low,igh,cscale,cperm,wk)
  2. c
  3. c     *****parameters:
  4.       integer igh,low,ma,mb,n
  5.       double precision a(ma,n),b(mb,n),cperm(n),cscale(n),wk(n,6)
  6. c
  7. c     *****local variables:
  8. c     none
  9. c
  10. c     *****functions:
  11. c     none
  12. c
  13. c     *****subroutines called:
  14. c     reduce, scaleg, gradeq
  15. c
  16. c     ---------------------------------------------------------------
  17. c
  18. c     *****purpose:
  19. c     this subroutine balances the matrices a and b to improve the
  20. c     accuracy of computing the eigensystem of the generalized
  21. c     eigenproblem a*x = (lambda)*b*x.  the algorithm is specifically
  22. c     designed to precede qz type algorithms, but improved performance
  23. c     is expected from most eigensystem solvers.
  24. c     ref.:  ward, r. c., balancing the generalized eigenvalue
  25. c     problem, siam j. sci. stat. comput., vol. 2, no. 2, june 1981,
  26. c     141-152.
  27. c
  28. c     *****parameter description:
  29. c
  30. c     on input:
  31. c
  32. c       ma,mb   integer
  33. c               row dimensions of the arrays containing matrices
  34. c               a and b respectively, as declared in the main calling
  35. c               program dimension statement;
  36. c
  37. c       n       integer
  38. c               order of the matrices a and b;
  39. c
  40. c       a       real(ma,n)
  41. c               contains the a matrix of the generalized eigenproblem
  42. c               defined above;
  43. c
  44. c       b       real(mb,n)
  45. c               contains the b matrix of the generalized eigenproblem
  46. c               defined above;
  47. c
  48. c       wk      real(n,6)
  49. c               work array that must contain at least 6*n storage
  50. c               locations.  wk is altered by this subroutine.
  51. c
  52. c     on output:
  53. c
  54. c       a,b     contain the balanced a and b matrices;
  55. c
  56. c       low     integer
  57. c               beginning -1 of the submatrices of a and b
  58. c               containing the non-isolated eigenvalues;
  59. c
  60. c       igh     integer
  61. c               ending -1 of the submatrices of a and b
  62. c               containing the non-isolated eigenvalues.  if
  63. c               igh = 1 (low = 1 also), the a and b matrices have
  64. c               been permuted into upper triangular form and have
  65. c               not been balanced;
  66. c
  67. c       cscale  real(n)
  68. c               contains the exponents of the column scaling factors
  69. c               in its low through igh locations and the reducing
  70. c               column permutations in its first low-1 and its
  71. c               igh+1 through n locations;
  72. c
  73. c       cperm   real(n)
  74. c               contains the column permutations applied in grading
  75. c               the a and b submatrices in its low through igh
  76. c               locations;
  77. c
  78. c       wk      contains the exponents of the row scaling factors
  79. c               in its low through igh locations, the reducing row
  80. c               permutations in its first low-1 and its igh+1
  81. c               through n locations, and the row permutations
  82. c               applied in grading the a and b submatrices in its
  83. c               n+low through n+igh locations.
  84. c
  85. c     *****algorithm notes:
  86. c     none
  87. c
  88. c     *****history:
  89. c     written by r. c. ward.......
  90. c
  91. c     ---------------------------------------------------------------
  92. c
  93.       call reduce (n,ma,a,mb,b,low,igh,cscale,wk)
  94.       if (low .eq. igh) go to 10
  95.       call scaleg (n,ma,a,mb,b,low,igh,cscale,cperm,wk)
  96.       call gradeq (n,ma,a,mb,b,low,igh,cperm,wk(1,2))
  97.    10 continue
  98.       return
  99. c
  100. c     last line of balgen
  101. c
  102.       end
  103.